package com.cheems.controller;

import com.cheems.entity.Result.Result;
import com.cheems.entity.Pojo.TopPic;
import com.cheems.service.TopPicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "首页大图相关接口")
public class TopPicController {

    @Autowired
    private TopPicService topPicService;

    /**
     * 获取首页大图
     * @return
     */
    @GetMapping("/homeBanner")
    @ApiOperation("获取首页大图")
    //@CrossOrigin 用于解决跨域问题
    public Result homeBanner(){
        log.info("获取首页大图");
        List<TopPic> topPicList = topPicService.homeBanner();
        return Result.success(topPicList);
    }
}
